package com.sias.oj.service;

import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import com.sias.oj.model.entity.Post;
import com.sias.oj.model.entity.PostFavour;
import com.sias.oj.model.entity.User;

/**
 * 帖子收藏服务
 *
 * @author <a href="https://github.com/sogra">程序员sogra</a>
 */
public interface PostFavourService extends IService<PostFavour> {

  /**
   * 帖子收藏
   *
   * @param postId
   * @param loginUser
   * @return
   */
  int doPostFavour(long postId, User loginUser);

  /**
   * 分页获取用户收藏的帖子列表
   *
   * @param page
   * @param queryWrapper
   * @param favourUserId
   * @return
   */
  Page<Post> listFavourPostByPage(IPage<Post> page, Wrapper<Post> queryWrapper,
                                  long favourUserId);

  /**
   * 帖子收藏（内部服务）
   *
   * @param userId
   * @param postId
   * @return
   */
  int doPostFavourInner(long userId, long postId);
}
